var app = getApp();
Page({
  data: {
    coupons: [],
  },
  onLoad: function () {
    var self = this;
    var openid = app.globalData.userInfo.open_id
    if(openid){
        wx.request({
          url: app.globalData.apiUrl + '/api/user/useCoupon',
          data: {'openid':openid},
          method: 'GET',
          dataType: 'json',
          success: function(res) {
            self.setData({coupons:res.data})
          },
          fail: function(res) {},
          complete: function(res) {},
        })
    }else{
      wx.showToast({
        title: '你还没登入',
        icon: 'none',
        duration: 2000
      })
    }
  },

})
